/**
 * 费用承担公司
 */
var costunit = _Z.tb0.costunit;
/**
 * 费用承担部门
 */
var costdept = _Z.tb0.costdept;
/**
 * 单据日期
 */
var billdate = _Z.tb0.tianbrq;
/**
 * 交易类型
 */
var billType = _Z.tb0.billType;
/**
 * 收支项目编码
 */
var incomeCode = _Z.tb1.incomeCode;
/**
 * 报销金额
 */
var reimbursement = _Z.tb1.baoxje;

var flag = false;
var budgetData = [];

jQuery(document).ready(function(){
	var fn_checkCustomize = window.checkCustomize;
	window.checkCustomize = function(){
		if(fn_checkCustomize()){
			if(flag) return true;
			remindInfo();
			return false;
		}
		return false;
	};
});


function remindInfo(){
	var incomeCodesValues = _C.stEach(incomeCode);
	var reimbursementsValues = _C.stEach(reimbursement);
	var values = new Array();
	for(var i=0;i<incomeCodesValues.length;i++){
		var ob = {
			costcode : incomeCodesValues[i],
			cmoney : reimbursementsValues[i]
		};
		values.push(ob);
	}
	var data = {
		costunit : _F.null2String(jQuery("#"+costunit).val()),
		costdept : _F.null2String(jQuery("#"+costdept).val()),
		billdate : _F.null2String(jQuery("#"+billdate).val()),
		billtype : _F.null2String(jQuery("#"+billType).val()),
		costItems : JSON.stringify(values)
	};
	var url = "/NcApi.getBudgetExceed.app";
	var result = _C.ajaxJson(url,data);
	if(result){
		budgetData = result;
		showBudgetInfo();
	}
	return false;
}

function showBudgetInfo(){
	var dlg = new window.top.Dialog();	
	dlg.currentWindow = window;
	dlg.Model=true;
	dlg.maxiumnable=true;
	dlg.Width=900;
	dlg.Height=450;
	dlg.URL="/westvalley/workflow/nc/C001/jsp/budgetInfo.jsp";
	dlg.Title="预算使用情况";
	dlg.CancelEvent = function(){
		dlg.close();
	};
	dlg.show();
}